package cn.hw.server.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.hibernate.annotations.*;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 应用信息
 */
@Entity
@Table(name = "system_application")
@Data
@SQLDelete(sql = "update system_application set deleted = true where id = ?")
@Where(clause = "deleted = false")
public class Application implements Serializable {

    //应用id
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    //应用姓名
    private String name;


    private String clientUrl;


    @ColumnDefault(value = "false")
    @JsonIgnore
    private Boolean deleted = false;

    //当前应用的sessionid
    @Transient
    private String jsessionid;


    @CreationTimestamp
    @Column(updatable = false)
    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @UpdateTimestamp
    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone = "GMT+8")
    private Date updateTime;


}
